'use strict';
const router = require('express').Router();

const cart = require('../controller/cart');
const goods = require('../controller/goods');
const index = require('../controller/index');
const catalog = require('../controller/catalog');


/**
 * 首页分类楼层数据
 */
router.get('/index', index.index);

router.get('/catalog', catalog.getNav);
router.get('/catalog/:id', catalog.getList);
router.get('/catalog/getBrotherList/:id', catalog.getBrotherList);

/**
 * 商品详情页面
 */
router.get('/goods/info', goods.info);
router.get('/goods/count', goods.count);
router.get('/goods/list/:id', goods.list);
router.post('/goods/search', goods.search);
router.post('/goods/search/help', goods.searchHelp);
router.post('/goods/search/history', goods.historyKeyword);
router.post('/goods/search/history/clear', goods.clearKeywordHistory);
router.get('/goods/search/keyword/hot', goods.hotKeyword);

/**
 * 购物车相关
 */
router.get('/cart', cart.list);
router.post('/cart/add', cart.add);
router.get('/cart/drop', cart.drop);


module.exports = router;
